﻿package mortal.game.view.copy.yanwuCopy
{
    import com.mui.controls.*;
    import extend.language.*;
    import fl.data.*;
    import flash.display.*;
    import flash.events.*;
    import mortal.common.global.*;
    import mortal.component.window.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.copy.treasureHunt.renderer.*;
    import mortal.game.view.godLuckGift.data.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class YanwuEnterWin extends ActivityBaseWindow
    {
        protected var _normalYanwu:GLoadingButton;
        protected var _effectiveYanwu:GLoadingButton;
        private var _rewardItemList:GTileList;
        private var _queueTxt:GTextFiled;
        private var _timeTxt:GTextFiled;
        private static var _instance:YanwuEnterWin;

        public function YanwuEnterWin(param1:ILayer = null)
        {
            super(param1, ImagesConst.YanwuCopyEnterTitle, ImagesConst.YanwuCopyEnterBg);
            this.setSize(696, 412);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.createChild();
            return;
        }// end function

        private function createChild() : void
        {
            this.pushUIToDisposeVec(UIFactory.gTextField(Language.getString(90409), 317 - 60, 61 - 35 + 203, 203 + 25, 25, this, GlobalStyle.textFormatLv.setSize(14)));
            this._effectiveYanwu = UIFactory.gLoadingButton(ResFileConst.YanwuNormalBtn, 100 + 34, 500 - 112, 187, 54, this);
            pushUIToDisposeVec(UIFactory.gTextField(Language.getString(90410), 122, 6, 220, 20, this._effectiveYanwu, GlobalStyle.textFormatLv));
            pushUIToDisposeVec(UIFactory.gTextField(Language.getString(90411), 71, 24, 220, 20, this._effectiveYanwu, GlobalStyle.textFormatLv));
            this._normalYanwu = UIFactory.gLoadingButton(ResFileConst.YanwuEffectiveBtn, 350 + 34, 500 - 112, 187, 54, this);
            pushUIToDisposeVec(UIFactory.gTextField(Language.getString(90412), 122, 6, 220, 20, this._normalYanwu, GlobalStyle.textFormatLv));
            pushUIToDisposeVec(UIFactory.gTextField(Language.getString(90413), 71, 24, 220, 20, this._normalYanwu, GlobalStyle.textFormatLv));
            pushUIToDisposeVec(UIFactory.gTextField(Language.getString(90414), 317 - 60 + 30, 61 - 35 + 203 + 48, 203 + 25, 25, this, GlobalStyle.textFormatLv.setSize(14)));
            this._queueTxt = UIFactory.gTextField(Language.getString(90415), 317 - 60 + 23, 61 - 35 + 203 + 100, 203 + 25, 25, this, GlobalStyle.textFormatHuang.setSize(14));
            this._timeTxt = UIFactory.gTextField("10:10:10", 317 + 4, 61 - 65 + 203 + 150, 203 + 25, 25, this, GlobalStyle.textFormatHuang.setSize(14));
            this._effectiveYanwu.configEventListener(MouseEvent.CLICK, this.onEffectiveEnter);
            this._normalYanwu.configEventListener(MouseEvent.CLICK, this.onNormalEnter);
            this._enterBtn.visible = false;
            this._rewardItemList = UIFactory.tileList(177 + 15, 342 - 29 + 45 - 86, 275, 45, this.contentTopOf3DSprite);
            this._rewardItemList.columnWidth = 44;
            this._rewardItemList.rowHeight = 43;
            this._rewardItemList.horizontalGap = 0;
            this._rewardItemList.verticalGap = 0;
            this._rewardItemList.setStyle("skin", new Bitmap());
            this._rewardItemList.setStyle("cellRenderer", TreasureRewardItemCellRenderer);
            this.updateReward();
            this.initItemList();
            return;
        }// end function

        private function initItemList() : void
        {
            var _loc_1:Array = [];
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._rewardItemList = null;
            this._effectiveYanwu = null;
            this._normalYanwu = null;
            this._queueTxt = null;
            this._timeTxt = null;
            return;
        }// end function

        override protected function updateBtnSize() : void
        {
            if (_closeBtn)
            {
                _closeBtn.x = this.width - _closeBtn.width - 20;
                _closeBtn.y = 7;
            }
            return;
        }// end function

        private function updateReward() : void
        {
            var _loc_1:* = GodLuckGiftUtil.getRewardArr();
            this._rewardItemList.dataProvider = new DataProvider(_loc_1);
            this._rewardItemList.drawNow();
            return;
        }// end function

        private function onNormalEnter(event:MouseEvent) : void
        {
            YanwuAcountWin.instance.show();
            Dispatcher.dispatchEvent(new DataEvent(EventName.YanwuRequest, 0));
            return;
        }// end function

        private function onEffectiveEnter(event:MouseEvent) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.YanwuRequest, 1));
            return;
        }// end function

    }
}
